package com.monkeyk.sos.web.controller.unity;

import com.leimingtech.core.common.IdGen;
import com.monkeyk.sos.domain.dto.UserJsonDto;
import com.monkeyk.sos.service.OauthRetrofitService;
import com.monkeyk.sos.service.OauthToken;
import com.monkeyk.sos.service.UserService;
import com.monkeyk.sos.utils.RetrofitUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.util.IdGenerator;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

import java.io.IOException;

import static com.monkeyk.sos.utils.RetrofitUtils.CLIENT_ID_UNITY;
import static com.monkeyk.sos.utils.RetrofitUtils.CLIENT_SECURITY_UNITY;

/**
 * @author Shengzhao Li
 */
@Controller
@RequestMapping("/unity/")
@Slf4j
public class UnityController {

    @Autowired
    private UserService userService;

    @Value("oauth.server.host")
    private String oauthServerHost;

    @RequestMapping("dashboard")
    public String dashboard() {
        return "unity/dashboard";
    }

    @RequestMapping("user_info")
    @ResponseBody
    public UserJsonDto userInfo() {
        return userService.loadCurrentUserJsonDto();
    }

}